
#include <BPhysics>
#include "member_BPhysics.h"

using namespace BWE;

#define member					(*(member_BPhysics*)_ptr)
#define member_allocate()		_ptr = new member_BPhysics(this)
#define member_release()		delete (member_BPhysics*)_ptr

BPhysics::BPhysics()
{
	member_allocate();
}
BPhysics::~BPhysics()
{
	member_release();
}

void BPhysics::setMass(BReal mass)
{
	member.mass = mass;
	this->emit(Signal_Changed);
}
BReal BPhysics::mass() const
{
	return member.mass;
}

void BPhysics::setFriction(BReal friction)
{
	member.friction = friction;
	this->emit(Signal_Changed);
}
BReal BPhysics::friction() const
{
	return member.friction;
}

void BPhysics::setElastane(BReal elastane)
{
	member.elastane = elastane;
	this->emit(Signal_Changed);
}
BReal BPhysics::elastane() const
{
	return member.elastane;
}

void BPhysics::setForce(BReal fx, BReal fy, BReal fz)
{
	setForce(BVector(fx, fy, fz));
}
void BPhysics::setForce(const BVector& force)
{
	if (member.force != force)
	{
		member.force = force;
		this->emit(Signal_Changed);
	}
}
const BVector& BPhysics::force() const
{
	return member.force;
}

void BPhysics::setGravity(BReal gx, BReal gy, BReal gz)
{
	setGravity(BVector(gx, gy, gz));
}
void BPhysics::setGravity(const BVector& gravity)
{
	if (member.gravity != gravity)
	{
		member.gravity = gravity;
		this->emit(Signal_Changed);
	}
}
const BVector& BPhysics::gravity() const
{
	return member.gravity;
}

void BPhysics::setVelocity(const BVector& velocity)
{
	member.velocity = velocity;
}
const BVector& BPhysics::velocity() const
{
	return member.velocity;
}

void BPhysics::setRotation(const BVector& rotation)
{
	member.rotation = rotation;
}
const BVector& BPhysics::rotation() const
{
	return member.rotation;
}
